<?php if (isset($articles)): ?>

<?php //pr ($this) ?>

<?php if ($this->action == 'show'): ?>
	<?php $title = $articles[0]['Article']['title'] . ' / Статьи ' ?>
<?php else: ?>
	<?php $title = 'Статьи' ?>
<?php endif ?>
<?php $this->set('title_for_layout', $title) ?>


<div class="articles">

<?php foreach ($articles as $k => $v): ?>

        <?php //pr ($v) ?>
        <ul>
		<?php //$pLink = '/articles/show/'. $v['Article']['id'] .'/'. $v['Article']['slug'] ?>
		<?php $pLink = '/articles/show/'. $v['Article']['id'] ?>
		<?php $pLink .= '/' . $post->trasnlite($v['Article']['slug']) ?>
                <li class="title"><h1><a href="<?php echo $pLink ?>/"><?php echo $v['Article']['title'] ?></a></h1></li>
		<?php $params = array('cut'=>$rhcut, 'link'=>$pLink. '#rhcut') ?>
                <li class="content"><?php echo $post->pre($v['Article']['body'], $params) ?></li>
                <li class="tags"><?php echo $post->tags($v['Article']['tags'], 'articles') ?></li>
                <li>
                        <table class="detail">
                                <tr>
                                        <td class="login"><?php echo $v['User']['login'] ?></td>
                                        <td class="date" title="<?php echo $v['Article']['created'] ?>"><?php echo $time->timeAgoInWords($v['Article']['created'], array('end'=>'2112-12-31')) ?></td>
					<?php if (!empty($User) && $User === $v['User']['login']) : ?>
                                        <td class="edit"><a href="/articles/edit/<?php echo $v['Article']['id'] ?>"><?php __('edit') ?></a></td>
					<?php endif ?>
                                </tr>
                        </table>
                </li>
        </ul>


<?php endforeach ?>

</div>

<?php endif ?>
